#include <stdio.h>

int n;
int data[21];
int used[21];
int ubb;
int ans;
int list[2097152], lp;
int list2[21][2097152], lp2[21];

int sum[2097152];

int dfs (int mask)
{
//	printf("dfs %d\n", mask);
	if (mask == 0)
		return 0;
	int lowbit = sum[mask&-mask];

//	printf("%d -> %d\n", mask , mask &~ (1 << lowbit));
	int re = dfs(mask &~ (1 << lowbit));

	for (int i = 0; i < lp2[lowbit]; i ++)
		if ((mask & list2[lowbit][i]) == list2[lowbit][i])
		{
//			printf("%d -> %d\n", mask ,mask - list2[lowbit][i]);
			int neo = dfs (mask - list2[lowbit][i]) + 1;
			if (neo > re)
				re = neo;
		}
	return re;
}

int main ()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i ++)
		scanf("%d", data + i);
	for (int i = 0; i < n; i ++)
	{
		int x;
		scanf("%d", &x);
		data[i] -= x;
	}

	ans = n;

	for (int i = 0; i < n; i ++)
		used[i] = 0;
	ubb = 0;
	for (int i = 0; i < n; i ++)
		if (data[i] == 0)
		{
			ans --;
			used[i] = 1;
			ubb |= (1 << i);
		}
	for (int i = 0; i < n; i ++)
		if (!used[i])
			for (int j = 0; j < n; j ++)
				if (!used[j] && data[i] + data[j] == 0)
				{
					ans --;
					used[i] = 1;
					used[j] = 1;
					ubb |= (1 << i) | (1 << j);
					break;
				}

	for (int i = 0; i < n; i ++)
		sum[1 << i] = data[i];

	lp = 0;

	for (int i = 0; i < ( 1 << n); i ++)
	{
		if (i)
		{
			sum[i] = sum[i - (i&-i)] + sum[i&-i];
		}
		else
			sum[i] = 0;
		if (sum[i] == 0 && (i & ubb) == 0 && i != 0)
			list[lp ++] = i;
	}

	for (int i = 0; i < n; i ++)
		sum[1 << i] = i;
	for (int i = 0; i < n; i ++)
		lp2[i] = 0;
	for (int i = 0; i < lp; i ++)
		list2[sum[list[i]&-list[i]]][lp2[sum[list[i]&-list[i]]] ++] = list[i];
/*
	for (int i = 0; i < lp; i ++)
		printf("list[%d] = %d\n", i, list[i]);
	for (int i = 0; i < n; i ++)
	{
		printf("%d: ", i);
		for (int j = 0; j < lp2[i]; j ++)
			printf("%d ", list2[i][j]);
		printf("\n");
	}
*/
	if (sum[(1 << n) - 1] != 0)
		printf("-1\n");
	else
	{
		printf("%d\n", ans - dfs((1 << n) - 1 - ubb));
	}

	return 0;
}